<tagLib name="html" />
{$header}
<div id="main" class="main" >
<!-- 主体内容  -->
<div class="content" >
  
<!--  功能组区域  -->
<div class="btn-toolbar">
      <div class="btn-group">
  	<button class="btn btn-primary" onclick="add()"><i class="icon-plus icon-white"></i> 新增</button>
    <button class="btn btn-primary" onclick="charge()"><i class="icon-user icon-white"></i> 分配</button>
    <button class="btn btn-primary" onclick="tocheck()"><i class="icon-warning-sign icon-white"></i>待分配</button>
  	<button class="btn btn-primary" onclick="foreverdel()"><i class="icon-trash icon-white"></i> 删除</button>
        <!--order priority-->
		<a href="__URL__/index/priority/0/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-question-sign"></i>普通</a>
		<a href="__URL__/index/priority/1/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-ok-sign"></i>现货</a>
		<a href="__URL__/index/priority/2/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-info-sign"></i>急单</a>
		<a href="__URL__/index/priority/3/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-exclamation-sign"></i>催单</a>
		<a href="__URL__/index/exception_status/9/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn btn-warning"><i class="icon-exclamation-sign"></i>退货订单</a>

    <form class="search-form pull-right" method='get' action="__URL__">
    <input type="text" class="search-query span1" name="order_detail_mano" <notempty name='_REQUEST.order_detail_mano'>
    <php>echo 'value="'.urldecode($_REQUEST['order_detail_mano']).'"'</php>
    <else/>
    placeholder="销售单号"
  </notempty>
  >
  <input type="submit" class="btn btn-primary" value="搜索销售分单号"></form>
    </div>
    <form class="search-form pull-right" method='get' action="__URL__">
      <select name="time_type" class="span1"> 
      <option value="1" <eq name="_REQUEST.time_type" value="1">selected</eq> >交货期</option> 
      <option value="2" <eq name="_REQUEST.time_type" value="2">selected</eq> >采购时间</option> 
      <option value="3" <eq name="_REQUEST.time_type" value="3">selected</eq> >到货时间</option> 
    </select>
    从<input type="text" class="span2"  name="start_time" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<notempty name='_REQUEST.start_time'>{$_REQUEST.start_time}</notempty>">
    到<input type="text" class="span2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" name="end_time" id="end_time" value="<notempty name='_REQUEST.end_time'>{$_REQUEST.end_time}</notempty>" >
    负责人{:modList( 'User',$_REQUEST['charge_man'],'span1','charge_man' )}
    询价负责人{:modList( 'User',$_REQUEST['ask_charge_man'],'span1','ask_charge_man' )}
      采购{:configList(C('buyStatus'),$_REQUEST['status'],'status','span1' )}
      货前样检{:configList(C('sampleQcStatus'),$_REQUEST['sample_qc_status'],'sample_qc_status','span1' )}
      入库质检{:configList(C('inQcStatus'),$_REQUEST['in_qc_status'],'in_qc_status','span1' )}
      付款{:configList(C('payStatus'),$_REQUEST['pay_status'],'pay_status','span1')}
      异常管理{:configList(C('exceptionStatus'),$_REQUEST['exception_status'],'exception_status','span1')}
        <input type="text" class="search-query span3" name="supplier" <notempty name='_REQUEST.supplier'>
        <php>echo 'value="'.urldecode($_REQUEST['supplier']).'"'</php>
        <else/>
        placeholder="供应商"
      </notempty> >
        <input type="text" class="search-query span3" name="keywords" <notempty name='_REQUEST.keywords'>
              <php>echo 'value="'.urldecode($_REQUEST['keywords']).'"'</php><else/>
              placeholder="按采购订单号 CAS号 ，中文名，英文名搜索"
          </notempty>
          >
          <input type="submit" class="btn btn-primary" value="搜索">
    </form>
          
  </div>
<!-- 功能组区域结束 -->
<php>
    function getMano($oid){
      return getModelName($oid,'Order_detail','mano');
  }

  function getPriority($oid){
      return getConfigVal(getModelName($oid,'Order_detail','priority'),'priority');
  }

  function getOrderDeliveryDate($oid){
      return toDate(getModelName($oid,'Order_detail','delivery_date') ,'Y-m-d');
  }

  function getDateStr($time){
   return toDate($time,'Y-m-d');
}
</php>
<!-- 列表显示区域  -->
<div class="list" >
 <div class="btn-toolbar">
  <div class="btn-group">
    <a href="__URL__/index" class="btn"><i class="icon-th-list"></i>全部采购订单</a>
    <a href="__URL__/index/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn"><i class="icon-flag"> </i>我的采购单</a>
    <?php $ods = C('buyStatus'); ?>
    <foreach name="ods" item="vo">
      <a href="__URL__/index/status/{$key}/charge_man/{:$_SESSION[C('USER_AUTH_KEY')]}" class="btn"><i class="icon-th-list"></i>{$vo}</a>
    </foreach>
    
  </div>
</div>
<div id="result" class="result none"></div><html:list id="checkList" style="table table-bordered table-striped" name="action" checkbox="true" action="true" datasource="list" show="id:编号|5%:edit,mano:采购单号,order_detail_id|getMano:销售单号,order_detail_id|getMsgTip:备注,product_id|getPfullName:产品|250px,product_id|getCas:CAS,supplier_id|getModelName=Supplier:供应商,number:数量,total:总价,order_detail_id|getOrderDeliveryDate:订单要求交货期,order_detail_id|getPriority:优先级,charge_man|getModelName=User:负责人,ask_charge_man|getModelName=User:询价负责人,user_id|getModelName=User:经办人,create_time|getDateStr:采购时间,receive_time|getDateStr:到货时间,pay_status|getConfigVal=Paystatus:付款状态,status|getConfigVal=buyStatus:状态,sample_qc_status|getConfigVal=sampleQcStatus:样检" actionlist="edit:详情:id" />
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<!-- 主页面结束 --><include file="Public:footer"/>
<script type="text/javascript">
  function fastadd(){
    location.href=URL+"/fastadd";
  }

  function charge(id){
    var keyValue;
    if (id)
    {
      keyValue = id;
    }else {
      keyValue = getSelectCheckboxValues();
    }
    if (!keyValue)
    {
      alert('请选择采购单！');
      return false;
    }
    location.href=URL+"/charge/id/"+keyValue;
  }

  function quicksale(id){
    var keyValue;
    if (id)
    {
      keyValue = id;
    }else {
      keyValue = getSelectCheckboxValues();
    }
    if (!keyValue)
    {
      alert('请选择入库单！');
      return false;
    }
    location.href=APP+"/Sale/fastadd/enter_id/"+keyValue;
  }
</script>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
